# $Id: PKGBUILD 89267 2013-04-28 11:41:10Z schuay $
# Maintainer: schuay <jakob.gruber@gmail.com>
# Contributor: Ray Powell <ray_al@xphoniexx.net>

pkgname=mcomix
pkgver=1.00
pkgrel=1
pkgdesc="A user-friendly, customizable image viewer specifically designed to handle comic books"
arch=('any')
url="http://sourceforge.net/projects/mcomix/"
license=('GPL')
depends=('pygtk' 'python-imaging' 'xdg-utils' 'python2' \
         'desktop-file-utils' 'hicolor-icon-theme' 'python2-distribute')
makedepends=('gettext' 'intltool')
optdepends=('unrar: for rar compressed comics')
conflicts=('comix')
replaces=('comix')
install='mcomix.install'
source=("http://downloads.sourceforge.net/project/mcomix/MComix-${pkgver}/mcomix-${pkgver}.tar.bz2")

build() {
  cd ${srcdir}/${pkgname}-${pkgver}

  # python2 fix
  for file in $(grep -Rl "/usr/bin/env python" .);
  do
    sed -i 's_#!/usr/bin/env python_#!/usr/bin/env python2_' $file
  done
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}

  export PYTHONPATH=${pkgdir}/usr/lib/python2.7/site-packages/
  mkdir -p $PYTHONPATH

  python2 setup.py install --prefix=/usr --optimize=1 \
    --single-version-externally-managed --root=${pkgdir}

  install -Dm755 mime/comicthumb ${pkgdir}/usr/bin/comicthumb
  install -Dm644 mime/comicthumb.1.gz ${pkgdir}/usr/share/man/man1/comicthumb.1.gz
  install -Dm644 mime/comicbook.schemas ${pkgdir}/usr/share/gconf/schemas/mcomix.schemas
}

md5sums=('3a916dd9da17043ab59ccd17e26eb932')
